package com.example.controller.redis;

import com.example.util.redis.RedisUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author LiYuhang
 * @version 0.1
 * @application
 * @Date 2020/9/21 16:37
 */
@RestController
public class TestController {

    @Autowired
    RedisUtil redisUtil;
    //http://localhost:8082/setKey?key=测试&value=我爱美人
    @RequestMapping(value = "setKey")
    public String  setKey(String key,String value){
        return redisUtil.set(key,value) ? "成功" : "失败";
    }
    //http://localhost:8082/getKey?key=测试
    @RequestMapping(value = "getKey")
    public Object getKey(String key){
        return redisUtil.get(key);
    }

}
